package ru.usu.gv.gui.frames.styles;

import ru.usu.gv.gui.frames.EditVertexPanelBase;
import ru.usu.gv.gui.frames.ISaveCallback;
import ru.usu.gv.styles.Style;
import ru.usu.gv.styles.StyleFacade;

import java.util.List;

/**
 * @author spupyrev
 * 02.11.2008
 */
public class VertexStylePanel extends EditVertexPanelBase
{
	private Style style;

	public VertexStylePanel(Style style, List<ISaveCallback> saveCallbacks)
	{
		super(saveCallbacks);
		this.style = style;
		initializeComponent();
	}

	@Override
	protected String getVertexColor()
	{
		return style.getStringAttribute(StyleFacade.VERTEX_COLOR_ATTRIBUTE);
	}

	@Override
	protected double getVertexSize()
	{
		return style.getDoubleAttribute(StyleFacade.VERTEX_SIZE_ATTRIBUTE);
	}

	@Override
	protected String getVertexTypeId()
	{
		return style.getStringAttribute(StyleFacade.VERTEX_TYPE_ATTRIBUTE);
	}

	@Override
	protected void setVertexColor(String encodedColor)
	{
		style.setStringAttribute(StyleFacade.VERTEX_COLOR_ATTRIBUTE, encodedColor);
	}

	@Override
	protected void setVertexSize(double newSize)
	{
		style.setDoubleAttribute(StyleFacade.VERTEX_SIZE_ATTRIBUTE, newSize);
	}

	@Override
	protected void setVertexTypeId(String newVertexTypeId)
	{
		style.setStringAttribute(StyleFacade.VERTEX_TYPE_ATTRIBUTE, newVertexTypeId);
	}

}
